package com.zbkj.crmeb.task.product;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import lombok.extern.slf4j.Slf4j;

/**
 * x
 * 随机商品排序任务,每小时一次
 * @author muyu.myw
 * @date 2020/9/27 16:29
 */
@Slf4j
@Configuration
public class ProductSearchTask {
    @Value("${switch.task.ProductSearchTask:true}")
    Boolean runable = true;

    /**
     * 定时更新所有商品到es
     */
    //60分钟同步一次数据
//	@XxlJob("productImageTask")
    public void runTask(){
        log.info(" -------- execute  ProductSearchTask ! runable: {}",runable);
        // 测试环境关闭了
        if(!runable){
            return;
        }

        long start = System.currentTimeMillis();
//        productSearchService.updateData();
        log.info("run update product index success! costTime: {}",(System.currentTimeMillis()-start)/1000);
    }
}
